import main from '@/pages/common/main.vue';
import blank from '@/pages/common/blank.vue';

//发布测试Or正式
let isFormal = true;

//主网站域名
let webapiUrl = null;
let ajaxErrorUrl = null;
let websocketChatPort = null;
if (process.env.NODE_ENV === 'development') { //设置生产环境模式
	webapiUrl = "http://localhost:7006"; //"http://localhost:7006";
	ajaxErrorUrl = "";
	websocketChatPort = 206; //webSocket端口,本地206,本地发布是778
	console.log('开发环境', webapiUrl);
} else {
	if (isFormal) {
		webapiUrl = "http://crm.ybx365.com/"; //本地发布是http://localhost:777/ https://wwwwebapi.scmrrj.com/
		ajaxErrorUrl = "/api/Login/PostError";
		websocketChatPort = 206; //webSocket端口,本地206,本地发布是778
	} else {
		webapiUrl = "http://localhost:82/"; //本地发布是http://localhost:777/ http://localhost:7006
		ajaxErrorUrl = "/api/Login/PostError";
		websocketChatPort = 206; //webSocket端口,本地206,本地发布是778
	}
	console.log((isFormal ? "正式" : "测试") + '-生产环境', webapiUrl);
}
if (webapiUrl.lastIndexOf('/') == (webapiUrl.length - 1)) {
	webapiUrl = webapiUrl.substr(0, webapiUrl.length - 1);
}
//console.log("webapiUrl", webapiUrl);
let recordError = true;
let errorAction = "setErrorLogs";
let loginUrl = "/pages/login";
let tokenKey = "totalwebapitoken"; //尽量全小写,因为某些andriod的浏览器会转换为全小写的
let wechatTokenKey = "wechattotalwebapitoken"; //微信的token值
let testOpenID = "123456"; //测试OpenID
let tokenIsCookie = false; //是否是cookie存的
let loginWithPicValidate = false; //登录是否带图片验证,验证码的是在服务端配置的
let showLanguage = false; //是否显示多语言切换

let autoLogin = false; //自动给予一个token值
let themeName = "theme";
let routeName = "route";
let langName = "language";
let buttonName = "button";

export default {
	webapiUrl,
	loginUrl,
	tokenKey,
	wechatTokenKey,
	testOpenID,
	tokenIsCookie,
	loginWithPicValidate,
	ajaxErrorUrl,
	recordError,
	errorAction,
	showLanguage,
	websocketChatPort,

	autoLogin,
	themeName,
	routeName,
	langName,
	buttonName,

	storeObj: {
		state: {
			theme: {
				//横纵布局 horizontal 横向 vertical 纵向的
				layout: "horizontal"
			}
		}
	},

	routerRoutes: [
		{
			path: '/SysCustomer',
			component: main,
			redirect: 'noRedict',
			name: 'SysCustomer',
			meta: {
				title: '客户'
			},
			children: [
				{
					path: 'SysCustomerListNew',
					name: 'SysCustomerListNew',
					component: () => import('@/Partial/SysCustomer/SysCustomerListNew.vue'),
					meta: {
						title: '客户管理'
					}
				},
				{
					path: 'SysCustomerAddRedictNew',
					name: 'SysCustomerAddRedictNew',
					component: () => import('@/Partial/SysCustomer/SysCustomerAddRedictNew.vue'),
					meta: {
						title: '新增/编辑客户'
					}
				},
				{
					path: 'ReferrerListNew',
					name: 'ReferrerListNew',
					component: () => import('@/Partial/Referrer/ReferrerListNew.vue'),
					meta: {
						title: '推荐人管理'
					}
				}, {
					path: 'OrganizationListNew',
					name: 'OrganizationListNew',
					component: () => import('@/Partial/Organization/OrganizationListNew.vue'),
					meta: {
						title: '机构管理'
					}
				}]
		}
	]
}
